programming - windows - CreateWindowWhat links here?
The CreateWindow function creates an overlapped, pop-up, or child window. It specifies the window class, window title, window style, and (optionally) the initial position and size of the window. The function also specifies the window's parent or owner, if any, and the window's menu.

To use extended window styles in addition to the styles supported by CreateWindow, use the programming - windows - CreateWindowEx function.

Syntax
    HWND CreateWindow(          
        LPCTSTR   lpClassName,
        LPCTSTR   lpWindowName,
        DWORD     dwStyle,
        int       x,
        int       y,
        int       nWidth,
        int       nHeight,
        HWND      hWndParent,
        HMENU     hMenu,
        HINSTANCE hInstance,
        LPVOID    lpParam
    );


Parameters

Return Value
If the function succeeds, the return value is a handle to the new window.

If the function fails, the return value is NULL. To get extended error information, call GetLastError.

This function typically fails for one of the following reasons:



Remarks
Before returning, CreateWindow sends a [WM_CREATE] message to the window procedure. For overlapped, pop-up, and child windows, CreateWindow sends programming - windows - WM_CREATE, programming:windows:WM_GETMINMAXINFO, and programming:windows:WM_NCCREATE messages to the window. The lParam parameter of the programming - windows - WM_CREATE message contains a pointer to a programming:windows:CREATESTRUCT structure. If the WS_VISIBLE style is specified, CreateWindow sends the window all the messages required to activate and show the window.

If the created window is a child window, its default position is at the bottom of the Z-order. If the created window is a top-level window, its default position is at the top of the Z-order (but beneath all topmost windows unless the created window is itself topmost).

For information on controlling whether the Taskbar displays a button for the created window, see Managing Taskbar Buttons.

The following predefined system classes can be specified in the lpClassName parameter. Note the corresponding control styles you can use in the dwStyle parameter.

System classMeaning
BUTTON Designates a small rectangular child window that represents a button the user can click to turn it on or off. Button controls can be used alone or in groups, and they can either be labeled or appear without text. Button controls typically change appearance when the user clicks them. For more information, see [Buttons].
    • For a table of the button styles you can specify in the dwStyle parameter, see [Button Styles].
COMBOBOXDesignates a control consisting of a list box and a selection field similar to an edit control. When using this style, an application should either display the list box at all times or enable a drop-down list box. If the list box is visible, typing characters into the selection field highlights the first list box entry that matches the characters typed. Conversely, selecting an item in the list box displays the selected text in the selection field. For more information, see [Combo Boxes].
  • For a table of the combo box styles you can specify in the dwStyle parameter, see [Combo Box Styles].
  • EDITDesignates a rectangular child window into which the user can type text from the keyboard. The user selects the control and gives it the keyboard focus by clicking it or moving to it by pressing the TAB key. The user can type text when the edit control displays a flashing caret; use the mouse to move the cursor, select characters to be replaced, or position the cursor for inserting characters; or use the BACKSPACE key to delete characters. For more information, see [Edit Controls].

      • For a table of the edit control styles you can specify in the dwStyle parameter, see [Edit Control Styles].
    LISTBOXDesignates a list of character strings. Specify this control whenever an application must present a list of names, such as file names, from which the user can choose. The user can select a string by clicking it. A selected string is highlighted, and a notification message is passed to the parent window. For more information, see [List Boxes].

      • For a table of the list box styles you can specify in the dwStyle parameter, see [List Box Styles].
    MDICLIENTDesignates an MDI client window. This window receives messages that control the MDI application's child windows. The recommended style bits are WS_CLIPCHILDREN and WS_CHILD. Specify the WS_HSCROLL and WS_VSCROLL styles to create an MDI client window that allows the user to scroll MDI child windows into view.

      • For more information, see Multiple Document Interface.
    RichEditDesignates a Microsoft Rich Edit 1.0 control. This window lets the user view and edit text with character and paragraph formatting, and can include embedded Component Object Model (COM) objects. For more information, see [Rich Edit Controls].

    For a table of the rich edit control styles you can specify in the dwStyle parameter, see [Rich Edit Control Styles].
    RICHEDIT_CLASSDesignates a Rich Edit 2.0 control. This controls let the user view and edit text with character and paragraph formatting, and can include embedded COM objects. For more information, see [Rich Edit Controls].

      • For a table of the rich edit control styles you can specify in the dwStyle parameter, see [Rich Edit Control Styles].
    SCROLLBARDesignates a rectangle that contains a scroll box and has direction arrows at both ends. The scroll bar sends a notification message to its parent window whenever the user clicks the control. The parent window is responsible for updating the position of the scroll box, if necessary. For more information, see [Scroll Bars].

      • For a table of the scroll bar control styles you can specify in the dwStyle parameter, see [Scroll Bar Control Styles].
    STATICDesignates a simple text field, box, or rectangle used to label, box, or separate other controls. Static controls take no input and provide no output. For more information, see [Static Controls].

      • For a table of the static control styles you can specify in the dwStyle parameter, see [Static Control Styles].




    Note If you specify Microsoft Windows version 4.x or later when linking your application, its windows cannot have caption buttons unless they also have window menus. This is not a requirement if you specify Windows version 3.x when linking your application.

    Function Information
    programming - windows - CreateWindow
    filename:programming - windows - CreateWindow
    filename:programming%20%2D%20windows%20%2D%20CreateWindow
    last edit:December 03 2012 20:25:32 (4171 days ago)
    ct = 1714975591.000000 = May 06 2024 02:06:31
    ft = 1354584332.000000 = December 03 2012 20:25:32
    dt = 360391259.000000